package com.xxx4biji.annotation;

import com.sun.istack.internal.NotNull;
import org.junit.Test;

import java.lang.reflect.Method;

public class TestAnnotation {

    /**
     * 重复注解
     * @throws NoSuchMethodException
     */
    @Test
    public void test1() throws NoSuchMethodException {
        Class<TestAnnotation> cls = TestAnnotation.class;
        Method method = cls.getMethod("show");
        MyAnnotation[] mas = method.getAnnotationsByType(MyAnnotation.class);
        for (MyAnnotation myAnnotation : mas) {
            System.out.println(myAnnotation.value());
        }
    }

    @MyAnnotation("Hello")
    @MyAnnotation("World")
    //TYPE_PARAMETER  可以在参数上用
    public void show(@MyAnnotation("abc") String str){

    }
}
